package IC.SemanticChecks;

/**
 * This enum represent the different types of semantic errors
 */
public enum SemanticErrorType {
	
	//Tables Builder:
	INVALID_TYPE_NAME("Invalid type name.a types with same name already exist in current scope"),
	INVALID_KIND("Invalid kind. kind is not legal in current scope"),
	INVALID_PRIMITIVE_TYPE("Invalid primitive type. primitive type is undefined"),	
	INVALID_CLASS("Invalid class. class is undefined"),
	INVALID_CLASS_EXT("Invalid class extension. can't extend classes before defining them"),
	INVALID_BASE_CLASS("Invalid Base class. class can't be a base class for it self"),
	BASE_CLASS_UNDEFINED("Invalid Base class. base class is undefined"),	
	
	//Library Checks:
	INVALID_LIBRARY_NAME("Invalid Library name. Library name must be \"Library\""),
	
	//Scope Checks:
	INVALID_SHADOWING("Invalid shadowing. shadowing of extending class"),
	INVALID_OVERRIDDING("Invalid overriding. static and virtual method can't override one another"),
	INVALID_OVERLOADING("Invalid overloading. overloading is prohibited according to IC spec"),
	INVALID_VARIABLE_USAGE("Invalid variable usage. variable was not declared before use"),
	INVALID_STATIC_METHOD("Invalid static methos.method is undefined"),
	INVALID_VIRTUAL_METHOD("Invalid virtual methos.method is undefined"),
	INVALID_FIELD("Invalid field. field is undefined"),
	INVALID_THIS("Invalid \"This\". Can't use \"This\" in static methods"), 
	
	//Type Checks:
	INVALID_LITERAL("Invalid literal"), 		
	INVALID_RETURN_TYPE("Returned type is not consistent with method return type"),
	INVALID_ARRAY_INDEX("Invalid array index"),
	INVALID_LOCAL_VAR_INIT_TYPE("Invalid local var init type"),
	INVALID_ARGUMENTS_AMOUNT("Invalid number of arguments. number of arguments is not as expected"),
	INVALID_ARGUMENT_TYPE("Invalid argument type"),
	INVALID_ASSIGNMENT("Invalid assignment"), 				
	INVALID_IF_CONDITION("Invalid if condition"), 			
	INVALID_WHILE_CONDITION("Invalid while condition"), 	
	INVALID_ARRAY_TYPE("Invalid array type"), 				
	INVALID_CLASS_TYPE("Invalid class type"),
	INVALID_ARRAY_LENGTH("Invalid array length"), 			
	INVALID_MATH_BINARY_OP("Invalid math binary operation"), 		
	INVALID_MATH_UNARY_OP("Invalid math unary operation"),  		
	INVALID_LOGICAL_BINARY_OP("Invalid logical binary operation"),
	INVALID_LOGICAL_UNARY_OP("Invalid logical unary operation"),				
		
	//Main Checks:
	GTE_ONE_MAIN("Invalid number of main methods in your program"), 
	NO_MAIN("Can't find main method"),
	
	//BreakCont Checks:
	INVALID_BREAK("Invalid break. \"break\" must be used within a loop"),
	INVALID_CONTINUE("Invalid continue. \"continue\" must be used within a loop"), 
	
	//ReturnInit Checks:
	NO_RETURN("Not all method control path's return a value"),
	INVALID_VARIABLE_INIT("Variable must be initialized before use");
	
	private final String Msg;
	
	//C'tor
	SemanticErrorType(String Msg) {
		this.Msg = Msg;
	}

	public String getMsg() {
		return Msg;
	}

	public String toString() {
		return Msg;
	}
}
